﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="Admin.master" CodeFile="EditPhukien.aspx.cs"
    Inherits="Admin_EditPhukien" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content runat="server" ContentPlaceHolderID="meta">
    <meta name="description" content="Sửa Phu kien" />
    <meta name="keywords" content="Sửa Phu kien" />
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="title">
    Sửa Phu kien</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="head">
    <!-- Link shortcut icon-->
    <link rel="shortcut icon" type="image/ico" href="images/favicon2.html" />
    <!-- Link css-->
    <link href="jui/css/jquery.ui.theme.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/zice.style.css" />
    <link rel="stylesheet" type="text/css" href="css/icon.css" />
    <link rel="stylesheet" type="text/css" href="css/ui-custom.css" />
    <link rel="stylesheet" type="text/css" href="css/timepicker.css" />
    <link rel="stylesheet" type="text/css" href="components/colorpicker/css/colorpicker.css" />
    <link rel="stylesheet" type="text/css" href="components/elfinder/css/elfinder.css" />
    <link rel="stylesheet" type="text/css" href="components/datatables/dataTables.css" />
    <link rel="stylesheet" type="text/css" href="components/validationEngine/validationEngine.jquery.css" />
    <link rel="stylesheet" type="text/css" href="components/jscrollpane/jscrollpane.css"
        media="screen" />
    <link rel="stylesheet" type="text/css" href="components/fancybox/jquery.fancybox.css"
        media="screen" />
    <link rel="stylesheet" type="text/css" href="components/tipsy/tipsy.css" media="all" />
    <link rel="stylesheet" type="text/css" href="components/editor/jquery.cleditor.css" />
    <link rel="stylesheet" type="text/css" href="components/chosen/chosen.css" />
    <link rel="stylesheet" type="text/css" href="components/confirm/jquery.confirm.css" />
    <link rel="stylesheet" type="text/css" href="components/sourcerer/sourcerer.css" />
    <link rel="stylesheet" type="text/css" href="components/fullcalendar/fullcalendar.css" />
    <link rel="stylesheet" type="text/css" href="components/Jcrop/jquery.Jcrop.css" />
    <link href="css/dandelion.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/Style.css" />
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="components/flot/excanvas.min.js"></script><![endif]-->
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="components/ui/jquery.ui.min.js"></script>
    <script type="text/javascript" src="components/ui/jquery.autotab.js"></script>
    <script type="text/javascript" src="components/ui/timepicker.js"></script>
    <script type="text/javascript" src="components/colorpicker/js/colorpicker.js"></script>
    <script type="text/javascript" src="components/checkboxes/iphone.check.js"></script>
    <script type="text/javascript" src="components/elfinder/js/elfinder.full.js"></script>
    <script type="text/javascript" src="components/datatables/dataTables.min.js"></script>
    <script type="text/javascript" src="components/datatables/ColVis.js"></script>
    <script type="text/javascript" src="components/scrolltop/scrolltopcontrol.js"></script>
    <script type="text/javascript" src="components/fancybox/jquery.fancybox.js"></script>
    <script type="text/javascript" src="components/jscrollpane/mousewheel.js"></script>
    <script type="text/javascript" src="components/jscrollpane/mwheelIntent.js"></script>
    <script type="text/javascript" src="components/jscrollpane/jscrollpane.min.js"></script>
    <script type="text/javascript" src="components/spinner/ui.spinner.js"></script>
    <script type="text/javascript" src="components/tipsy/jquery.tipsy.js"></script>
    <script type="text/javascript" src="components/editor/jquery.cleditor.js"></script>
    <script type="text/javascript" src="components/chosen/chosen.js"></script>
    <script type="text/javascript" src="components/confirm/jquery.confirm.js"></script>
    <script type="text/javascript" src="components/validationEngine/jquery.validationEngine.js"></script>
    <script type="text/javascript" src="components/validationEngine/jquery.validationEngine-en.js"></script>
    <script type="text/javascript" src="components/vticker/jquery.vticker-min.js"></script>
    <script type="text/javascript" src="components/sourcerer/sourcerer.js"></script>
    <script type="text/javascript" src="components/fullcalendar/fullcalendar.js"></script>
    <script type="text/javascript" src="components/flot/flot.js"></script>
    <script type="text/javascript" src="components/flot/flot.pie.min.js"></script>
    <script type="text/javascript" src="components/flot/flot.resize.min.js"></script>
    <script type="text/javascript" src="components/flot/graphtable.js"></script>
    <script src="jui/js/jquery-ui-1.8.20.min.js" type="text/javascript"></script>
    <script src="plugins/validate/jquery.validate.min.js" type="text/javascript"></script>
    <script src="plugins/validate/jquery.validate.js" type="text/javascript"></script>
    <script src="js/demo.ui.js" type="text/javascript"></script>
    <link href="jui/css/jquery.ui.dialog.css" rel="stylesheet" type="text/css" />
    <link href="jui/css/jquery.ui.button.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="components/uploadify/swfobject.js"></script>
    <script type="text/javascript" src="components/uploadify/uploadify.js"></script>
    <script type="text/javascript" src="components/checkboxes/customInput.jquery.js"></script>
    <script type="text/javascript" src="components/effect/jquery-jrumble.js"></script>
    <script type="text/javascript" src="components/filestyle/jquery.filestyle.js"></script>
    <script type="text/javascript" src="components/placeholder/jquery.placeholder.js"></script>
    <script type="text/javascript" src="components/Jcrop/jquery.Jcrop.js"></script>
    <script type="text/javascript" src="components/imgTransform/jquery.transform.js"></script>
    <script type="text/javascript" src="components/webcam/webcam.js"></script>
    <script type="text/javascript" src="components/rating_star/rating_star.js"></script>
    <script type="text/javascript" src="components/dualListBox/dualListBox.js"></script>
    <script type="text/javascript" src="components/smartWizard/jquery.smartWizard.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script type="text/javascript" src="js/zice.custom.js"></script>
    <script src="js/demo.validation.js" type="text/javascript"></script>
    <script src="js/fileupload/ajaxupload.3.5.js" type="text/javascript"></script>
    <link href="js/fileupload/styles.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/Library.js" type="text/javascript"></script>
    <script src="js/scripts.js" type="text/javascript"></script>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="Maincontent">
    <div class="onecolumn">
        <div class="header">
            <span><span class="ico  gray random"></span>Sửa Phụ kiện </span><a class="uibutton icon prev"
                style="margin: 5px 0px 0px 20px" href="Phukien.aspx">Back</a>
            <asp:Button runat="server" ID="btnSubmit" CssClass="uibutton save_button" 
                Text="Save" onclick="btnSubmit_Click"
                 />
        </div>
        <!-- End header -->
        <div class=" clear">
        </div>
        <div class="content">
            <div id="uploadTab">
                <ul class="tabs">
                    <li><a href="#tab1" id="2">General </a></li>
                    <li><a href="#tab2" id="3">Images</a></li>
                </ul>
                <div class="tab_container">
                    <div id="tab1" class="tab_content">
                        <div class="load_page">
                            <div class="tableName">
                                <div id="da-ex-dialog-form-divsdaf" class="no-padding">
                                    <div id="da-validate-error" class="da-message error" style="display: none;">
                                    </div>
                                    <div class="da-form-inline">
                                        <div class="section da-form-row textonly large">
                                            <label>
                                                Model:</label>
                                            <div class="da-form-item large ">
                                                <asp:TextBox runat="server" ID="txtName" CssClass="large autourl_faq"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="section da-form-row large url">
                                            <label>
                                                Url:</label>
                                            <div class="da-form-item large">
                                                <asp:TextBox runat="server" ID="txtUrl" CssClass="large urlauto"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="section da-form-row">
                                            <label>
                                                Type Phụ kiện:</label>
                                            <div>
                                                <asp:DropDownList runat="server" ID="ddlLoaiPhukien" Width="200">
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                        <div class="section da-form-row">
                                            <label>
                                                </label>
                                            <div>
                                                <asp:Image runat="server" ID="img_phukien" Height="150" Width="220"/>
                                            </div>
                                        </div>
                                        <div class="section ">
                                            <label>
                                                Image:
                                            </label>
                                            <div>
                                                <asp:FileUpload runat="server" CssClass="fileupload" ID="fileupload_phukien" />
                                                <asp:HiddenField runat="server" ID="phukien_value" />
                                                <span id="status_phukien"></span>
                                                <div id="files_phukien"></div>
                                                <script type="text/javascript">
                        var url_phukien = "";
                        $(function () {
                            var btnUpload = $('#Maincontent_fileupload_phukien');
                            var status = $('#status_phukien');
                            var folder = "<% Server.MapPath("~/Images/news/"); %>";
                            new AjaxUpload(btnUpload, {
                                action: '<% Response.Write(Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~")); %>Admin/UploadImageNews.aspx',
                                name: 'uploadfile',
                                onSubmit: function (file, ext) {
                                    if (!(ext && /^(jpg|png|jpeg|gif)$/.test(ext))) {
                                        // extension is not allowed 
                                        status.addClass("error").text('Only JPG, PNG or GIF files are allowed');
                                        return false;
                                    }
                                    status.text('Uploading...');
                                },
                                onComplete: function (file, response) {
                                    //On completion clear the status
                                    status.text('');
                                    //Add uploaded file to list
                                    if (response === "success") {
                                        var src = '<% Response.Write(Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + ResolveUrl("~")); %>Images/news/' + file;
                                        url_phukien = '<% Response.Write(Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + ResolveUrl("~")); %>Images/news/' + file;
                                        var image = "<img src='" + src + "'/>";
                                        var name = "<br/>" + file;
                                        $("#Maincontent_phukien_value").val("Images/news/"+file);
                                        $('#files_phukien').html('Thêm image thành công').addClass('success');
                                    } else {
                                        $('#status_phukien').html('Thêm image gặp lỗi').addClass('error');
                                    }
                                }
                            });

                        });
                                                </script>
                                            </div>
                                        </div>
                                        <div class="section da-form-row large">
                                            <label>
                                                Description:</label>
                                            <div class="da-form-item large">
                                                <CKEditor:CKEditorControl runat="server" ID="ckeditor"></CKEditor:CKEditorControl>
                                            </div>
                                        </div>
                                        <div class="section da-form-row numericonly large">
                                            <label>
                                                Price Input:</label>
                                            <div class="da-form-item large">
                                                <asp:TextBox runat="server" ID="txtPriceInputs" CssClass="large"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="section da-form-row numericonly large">
                                            <label>
                                                Price Out:</label>
                                            <div class="da-form-item large">
                                                <asp:TextBox runat="server" ID="txtPriceOutputs" CssClass="large"></asp:TextBox>
                                            </div>
                                        </div>
                                        <div class="section da-form-row">
                                            <label>
                                                Status:</label>
                                            <div>
                                                <asp:DropDownList runat="server" ID="ddlStatus" Width="200">
                                                    <asp:ListItem Value="1">Enable</asp:ListItem>
                                                    <asp:ListItem Value="0">Disable</asp:ListItem>
                                                </asp:DropDownList>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div id="tab2" class="tab_content">
                        <div class="load_page">
                            <div class="tableName">
                                <div id="da-ex-dialog-form-divs" class="no-padding">
                                    <div id="da-validate-errors" class="da-message error" style="display: none;">
                                    </div>
                                    <div class="da-form-inline">
                                        <% int i = 1; foreach (Phukien_Image item in phukien)
                                           {%>
                                         <div class="section da-form-row large">
                                            <label>
                                                Image <%= i++ %>:</label>
                                            <div class="da-form-item large">
                                                <img src="<%= ResolveUrl("~/")+item.Image%>" class="img_phukien" id="phukien_images" height="150" width="300"/>
                                                
                                                <div class="iconBox color delete_image_phukien" id="<%= item.Phukien_Image_id %>" name="<%= item.Image %>" original-title="Delete"> <img src="images/icon/color_18/cross.png" alt="Delete"> </div>
                                            </div>
                                        </div>
                                           <% } %>
                                        
                                        <div class="section ">
                                            <label>
                                                Image:
                                            </label>
                                            <div>
                                                <asp:FileUpload runat="server" CssClass="fileupload" ID="fileupload_phukien_image" />
                                                <asp:HiddenField runat="server" ID="phukien_image_value" />
                                                <span id="status_phukien_image"></span>
                                                <div id="files_phukien_image">
                                                </div>
                                                <script type="text/javascript">
                                                    var url_news = "";
                                                    $(function () {
                                                        var btnUpload = $('#Maincontent_fileupload_phukien_image');
                                                        var status = $('#status_phukien_image');
                                                        var folder = "<% Server.MapPath("~/Images/news/"); %>";
                                                        new AjaxUpload(btnUpload, {
                                                            action: '<% Response.Write(Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~")); %>Admin/UploadImageNews.aspx',
                                                            name: 'uploadfile',
                                                            onSubmit: function (file, ext) {
                                                                if (!(ext && /^(jpg|png|jpeg|gif)$/.test(ext))) {
                                                                    // extension is not allowed 
                                                                    status.addClass("error").text('Only JPG, PNG or GIF files are allowed');
                                                                    return false;
                                                                }
                                                                status.text('Uploading...');
                                                            },
                                                            onComplete: function (file, response) {
                                                                //On completion clear the status
                                                                status.text('');
                                                                //Add uploaded file to list
                                                                if (response === "success") {
                                                                    var src = '<% Response.Write(Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + ResolveUrl("~")); %>Images/news/' + file;
                                                                    url_logo = '<% Response.Write(Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + ResolveUrl("~")); %>Images/news/' + file;
                                                                    var image = "<img src='" + src + "'/>";
                                                                    var name = "<br/>" + file;
                                                                    var str = $("#Maincontent_phukien_image_value").val();
                                                                    $("#Maincontent_phukien_image_value").val(str+","+"Images/news/"+file);
                                                                    $('#files_phukien_image').html('Thêm image thành công').addClass('success');
                                                                } else {
                                                                    $('#status_phukien_image').html('Thêm image gặp lỗi').addClass('error');
                                                                }
                                                            }
                                                        });

                                                    });
                                                </script>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clear" />
        </div>
    </div>
</asp:Content>
